package com.leetcode.jol;

import com.leetcode.entity.ListNode;
import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.info.GraphLayout;

public class JolMain {
    public static void main(String[] args) {
        ListNode head = new ListNode(10);
        head.next = new ListNode(11);
        // TODO 10 -> 11
        System.out.println("对象内部信息：");
        System.out.println(ClassLayout.parseInstance(head).toPrintable());
        System.out.println("对象整体信息：");
        System.out.println(GraphLayout.parseInstance(head).toPrintable());

        // TODO tail的地址和head的地址是一致的
        ListNode tail = head;
        tail.next = null;

        System.out.println("对象整体信息：");
        System.out.println(GraphLayout.parseInstance(head).toPrintable());

        // TODO tail.next 为空之后导致head.next为空
        System.out.println(head.next.val);
    }
}
